package com.example.demo.repository;

import com.example.demo.entity.Product.Files;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface FilesRepository extends CrudRepository<Files, Integer> {
    @Query(value = "select top 1 * from b_goods_picture f where f.goods_code = :goodsCode and f.pic_type = '缩略图' order by f.goods_code desc", nativeQuery = true)
    Files findImg(String goodsCode);

    @Query(value = "select top 1 * from b_goods_picture f where f.goods_code = :goodsCode and f.pic_type = '图纸' order by f.goods_code desc", nativeQuery = true)
    Files findPDF(String goodsCode);
}
